//
//  AppDelegate.m
//  DiDi
//
//  Created by huangtie on 2017/2/27.
//  Copyright © 2017年 黄铁. All rights reserved.
//

#import "ZBAppDelegate.h"
#import "SMTabBarController.h"

@interface ZBAppDelegate ()

@end

@implementation ZBAppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    [[UINavigationBar appearance] setBackgroundImage:[UIImage imageWithColor:SMCOLOR_MAIN] forBarMetrics:UIBarMetricsDefault];
    [[UINavigationBar appearance] setBarStyle:UIBarStyleBlack];
    [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:FONT_NORMAL_18}];
    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    [CSToastManager sharedStyle].messageFont = FONT_NORMAL_14;
    [CSToastManager setDefaultPosition:[NSValue valueWithCGPoint:CGPointMake(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 + 80)]];
    
    self.window = [[SMWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    self.window.rootViewController = [[SMTabBarController alloc] init];
    [self.window makeKeyAndVisible];
    
    return YES;
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
    return YES;
//    return [ShareSDK handleOpenURL:url wxDelegate:self];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    return YES;
//    return [ShareSDK handleOpenURL:url
//                 sourceApplication:sourceApplication
//                        annotation:annotation
//                        wxDelegate:self];
}

//-(void)onResp:(BaseResp *)resp{
//    if ([resp isKindOfClass:[PayResp class]]){
//        PayResp *response = (PayResp *)resp;
//        BOOL isSuccess = NO;
//        NSString *errorCode = INT_TO_STR(response.errCode);
//        NSString *errorMsg;
//        switch(response.errCode){
//            case WXSuccess:{
//                isSuccess = YES;
//                break;
//            }case WXErrCodeUserCancel:{
//                isSuccess = NO;
//                errorMsg = @"支付已取消";
//                break;
//            }
//            default:{
//                isSuccess = NO;
//                errorMsg = @"支付失败";
//                break;
//            }
//        }
//        if ([SMShareSDKManager shareManager].wxpayCompletionBlock) {
//            [SMShareSDKManager shareManager].wxpayCompletionBlock(isSuccess , errorCode , errorMsg);
//        }
//    }
//}

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    return self.allowRotate ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskPortrait;
}
@end
